#include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>
#include<stdlib.h>
int main()
{
    printf("I am a process : pid : %d \n",getpid());
    pid_t id = fork();
    if(id == 0)
    {
        execl("./mytest","mytest","-a","-l",NULL);

        //char *const argv[] = {(char*)"ls", (char*)"-a",(char*)"-l"};
        ////child
        //printf("execl begin ..\n");
        //execvp("ls",argv);
        //printf("execl end ..\n");
        //exit(1);
    }
    //father
    pid_t rid = waitpid(id, NULL , 0);
    if(rid>0)
    {
        printf("wait success, rid: %d\n",rid);
    }
    exit(1);



















    //printf("I am a process: pid : %d \n",getpid());
    //printf("execl begin ..\n");
    //sleep(5);
    ////execl("/usr/bin/ls","ls","-a","-l",NULL);
    //execl("/usr/bin/top","top",NULL);
    //printf("execl end ..\n");

    return 0;
}
